using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using FikriKibar.Entities.Concrete;

namespace FikriKibar.DataAccess.Mapping
{
    public class MenuItemHistoryMapping : EntityTypeConfiguration<MenuItemHistory>
    {
        public MenuItemHistoryMapping()
            : this("dbo")
        {
        }
 
        public MenuItemHistoryMapping(string schema)
        {
            ToTable(schema + ".MenuItemHistory");
            HasKey(x => x.Id);

            Property(x => x.Id).HasColumnName("Id").IsRequired().HasColumnType("int").HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(x => x.MenuItemId).HasColumnName("MenuItemId").IsRequired().HasColumnType("int");
            Property(x => x.MenuId).HasColumnName("MenuId").IsRequired().HasColumnType("int");
            Property(x => x.ActionName).HasColumnName("ActionName").IsOptional().HasColumnType("nvarchar").HasMaxLength(100);
            Property(x => x.ControllerName).HasColumnName("ControllerName").IsOptional().HasColumnType("nvarchar").HasMaxLength(100);
            Property(x => x.MenuUrl).HasColumnName("MenuUrl").IsOptional().HasColumnType("nvarchar").HasMaxLength(255);
            Property(x => x.UpdateDate).HasColumnName("UpdateDate").IsRequired().HasColumnType("datetime");
            Property(x => x.UpdatedBy).HasColumnName("UpdatedBy").IsRequired().HasColumnType("int");
            Property(x => x.DisplayOrder).HasColumnName("DisplayOrder").IsRequired().HasColumnType("int");
            Property(x => x.IsApproved).HasColumnName("IsApproved").IsRequired().HasColumnType("bit");
            Property(x => x.IsPublished).HasColumnName("IsPublished").IsRequired().HasColumnType("bit");
            Property(x => x.IsDeleted).HasColumnName("IsDeleted").IsRequired().HasColumnType("bit");
        }
    }

}
